﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Summary.master" AutoEventWireup="true"
    CodeFile="GradeScale.aspx.cs" Inherits="Grade_GradeScale" %>

<asp:Content ID="Content1" ContentPlaceHolderID="DetailHeaderContent" runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="DetailBodyContent" runat="Server">
    <asp:UpdatePanel ID="uplGradeScale" runat="server">
        <ContentTemplate>
            <asp:GridView ID="gvGradeScale" runat="server" Width="550px" AutoGenerateColumns="False"
                CssClass="table" ShowFooter="True" OnPageIndexChanging="OnPaging" OnRowEditing="EditGradeScale"
                OnRowUpdating="UpdateGradeScale" OnRowCancelingEdit="CancelEdit" OnRowDataBound="gvGradeScale_RowDataBound"
                OnRowCreated="gvGradeScale_RowCreated" 
                onselectedindexchanged="gvGradeScale_SelectedIndexChanged">
                <Columns>
                    <asp:TemplateField ItemStyle-Width="30px" HeaderText="GradeScaleID" Visible="false">
                        <ItemTemplate>
                            <asp:Label ID="lblGradeScaleID" runat="server" Text='<%# Eval("GradeScaleID")%>'></asp:Label>
                        </ItemTemplate>
                        <FooterTemplate>
                            <asp:TextBox ID="txtGradeScaleID" ReadOnly="true" Text="-1" Width="40px" MaxLength="5"
                                runat="server"></asp:TextBox>
                        </FooterTemplate>
                        <ItemStyle Width="30px" />
                    </asp:TemplateField>
                    <asp:TemplateField ItemStyle-Width="100px" HeaderText="Name">
                        <ItemTemplate>
                            <asp:Label ID="lblName" runat="server" Text='<%# Eval("Name")%>'></asp:Label>
                        </ItemTemplate>
                        <EditItemTemplate>
                            <asp:TextBox ID="txtName" runat="server" Text='<%# Eval("Name")%>'></asp:TextBox>
                        </EditItemTemplate>
                        <FooterTemplate>
                            <asp:TextBox ID="txtName" runat="server"></asp:TextBox>
                        </FooterTemplate>
                        <ItemStyle Width="100px" />
                    </asp:TemplateField>
                    <asp:TemplateField ItemStyle-Width="150px" HeaderText="ScaleValue">
                        <ItemTemplate>
                            <asp:Label ID="lblScaleValue" runat="server" Text='<%# Eval("ScaleValue")%>'></asp:Label>
                        </ItemTemplate>
                        <EditItemTemplate>
                            <asp:TextBox ID="txtScaleValue" runat="server" Text='<%# Eval("ScaleValue")%>'></asp:TextBox>
                        </EditItemTemplate>
                        <FooterTemplate>
                            <asp:TextBox ID="txtScaleValue" runat="server"></asp:TextBox>
                        </FooterTemplate>
                        <ItemStyle Width="150px" />
                    </asp:TemplateField>
                    
                    <asp:TemplateField ItemStyle-Width="150px" HeaderText="Calculate GPA?">
                        <ItemTemplate>
                            <asp:Label ID="lblCalculateGPA" runat="server" Text='N/A'></asp:Label>
                        </ItemTemplate>
                        <EditItemTemplate>
                            <asp:CheckBox ID="chkCalculateGPA" runat="server" Text=''></asp:CheckBox>
                        </EditItemTemplate>
                        <FooterTemplate>
                            <asp:CheckBox ID="chkCalculateGPA" runat="server" Text=''></asp:CheckBox>
                        </FooterTemplate>
                        <ItemStyle Width="150px" />
                    </asp:TemplateField>
                    <asp:TemplateField ItemStyle-Width="100px" HeaderText="Order">
                        <ItemTemplate>
                            <asp:Label ID="lblSortOrder" runat="server" Text='<%# Eval("SortOrder")%>'></asp:Label>
                        </ItemTemplate>
                        <EditItemTemplate>
                            <asp:TextBox ID="txtSortOrder" runat="server" Text='<%# Eval("SortOrder")%>'></asp:TextBox>
                        </EditItemTemplate>
                        <FooterTemplate>
                            <asp:TextBox ID="txtSortOrder" runat="server"></asp:TextBox>
                        </FooterTemplate>
                        <ItemStyle Width="100px" />
                    </asp:TemplateField>
                    <asp:TemplateField ItemStyle-Width="100px" HeaderText="Comments">
                        <ItemTemplate>
                            <asp:Label ID="lblComment" runat="server" Text='<%# Eval("Comment")%>'></asp:Label>
                        </ItemTemplate>
                        <EditItemTemplate>
                            <asp:TextBox ID="txtComment" runat="server" Text='<%# Eval("Comment")%>'></asp:TextBox>
                        </EditItemTemplate>
                        <FooterTemplate>
                            <asp:TextBox ID="txtComment" runat="server"></asp:TextBox>
                        </FooterTemplate>
                        <ItemStyle Width="100px" />
                    </asp:TemplateField>
                    <asp:TemplateField ItemStyle-Width="150px" HeaderText="Active">
                        <ItemTemplate>
                            <asp:Label ID="lblActive" runat="server" Text='N/A'></asp:Label>
                        </ItemTemplate>
                        <EditItemTemplate>
                            <asp:CheckBox ID="chkActive" runat="server" Text=''></asp:CheckBox>
                        </EditItemTemplate>
                        <FooterTemplate>
                            <asp:CheckBox ID="chkActive" runat="server" Text=''></asp:CheckBox>
                        </FooterTemplate>
                        <ItemStyle Width="150px" />
                    </asp:TemplateField>
                    <asp:TemplateField>
                        <ItemTemplate>
                            <asp:LinkButton ID="lnkRemove" runat="server" CommandArgument='<%# Eval("GradeScaleID")%>'
                                OnClientClick="return confirm('Do you want to delete?')" Text="Delete" OnClick="DeleteGradeScale"></asp:LinkButton>
                        </ItemTemplate>
                        <FooterTemplate>
                            <asp:Button ID="btnAdd" runat="server" Text="Add" OnClick="AddGradeScale" />
                        </FooterTemplate>
                    </asp:TemplateField>
                    <asp:CommandField ShowEditButton="True" />
                    <asp:CommandField ShowSelectButton="True" />
                </Columns>
                <AlternatingRowStyle CssClass="alt" />
            </asp:GridView>
        </ContentTemplate>
        <Triggers>
            <asp:AsyncPostBackTrigger ControlID="gvGradeScale" />
        </Triggers>
    </asp:UpdatePanel>
</asp:Content>
